﻿<%@ Page Title="d39 grid builder" Language="C#" MasterPageFile="~/d39.Master" AutoEventWireup="true" CodeBehind="GridBuild.aspx.cs" Inherits="d39.GridBuild" %>

<asp:Content ContentPlaceHolderID="GridPaneContent" runat="server">
    <asp:UpdatePanel runat="server" ID="GridUpdatePanel" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td></td>
                    <td align="center">
                        <asp:Button runat="server" Text="-5" CommandName="N" CommandArgument="-5" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="-1" CommandName="N" CommandArgument="-1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+1" CommandName="N" CommandArgument="1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+5" CommandName="N" CommandArgument="5" OnCommand="AdjustCommand" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 20px">
                        <asp:Button runat="server" Text="-5" CommandName="W" CommandArgument="-5" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="-1" CommandName="W" CommandArgument="-1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+1" CommandName="W" CommandArgument="1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+5" CommandName="W" CommandArgument="5" OnCommand="AdjustCommand" />
                    </td>
                    <td><d39:GridManipulator runat="server" id="GridManipulator" IncludeHalfCells="true" /></td>
                    <td style="width: 20px">
                        <asp:Button runat="server" Text="-5" CommandName="E" CommandArgument="-5" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="-1" CommandName="E" CommandArgument="-1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+1" CommandName="E" CommandArgument="1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+5" CommandName="E" CommandArgument="5" OnCommand="AdjustCommand" />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td align="center">
                        <asp:Button runat="server" Text="-5" CommandName="S" CommandArgument="-5" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="-1" CommandName="S" CommandArgument="-1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+1" CommandName="S" CommandArgument="1" OnCommand="AdjustCommand" />
                        <asp:Button runat="server" Text="+5" CommandName="S" CommandArgument="5" OnCommand="AdjustCommand" />
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

<asp:Content runat="server" ContentPlaceHolderID="ActionPaneContent">
    <asp:UpdatePanel runat="server" ID="ActionUpdatePanel" UpdateMode="Conditional">
        <ContentTemplate>
            <div><asp:LinkButton runat="server" ID="ShowColorDiv" OnClick="ShowColorDiv_Click" Visible='<%# !IsEditing %>'>(Change grid settings)</asp:LinkButton></div>
            <div runat="server" visible="false" id="GridColorDiv">
                <div>
                    <asp:Label AssociatedControlID="Name" runat="server">Grid Name:</asp:Label>
                    <asp:TextBox runat="server" ID="Name" Text='<%# CurrentGrid.Name %>' />
                </div>
                <div>
                    Background Color:
                    <d39:ColorPicker runat="server" id="BackgroundColor" Color='<%# CurrentGrid.BackgroundColor %>' />
                </div>
                <div>
                    Grid Line Color:
                    <d39:ColorPicker runat="server" id="GridLineColor" Color='<%# CurrentGrid.GridLineColor %>' />
                </div>
                <asp:LinkButton runat="server" ID="ChangeColors" OnClick="ChangeColors_Click">(Save changes)</asp:LinkButton>
                <asp:LinkButton runat="server" ID="CancelColors" OnClick="CancelColors_Click">(Cancel)</asp:LinkButton>
            </div>

            <asp:ListView runat="server" ID="Walls" ItemPlaceholderID="items">
                <LayoutTemplate><ul class="wallManip"><asp:PlaceHolder runat="server" ID="items" /></ul></LayoutTemplate>
                <ItemTemplate>
                    <li style='<%# Eval("CssStyle") %>'>
                        <div>
                            Wall Type: <%# Eval("Description") %>
                            <asp:LinkButton runat="server" ID="EditBtn" CommandName="Edit" Visible='<%# !IsEditing %>'>(Edit)</asp:LinkButton>
                            <asp:LinkButton runat="server" ID="DeleteBtn" CommandName="Delete" Visible='<%# !IsEditing %>'>(Delete)</asp:LinkButton>
                        </div>
                        <div><%# ((int) Eval("Opacity")) * 10 %>% opaque</div>
                        <div>Color: <%# Eval("ColorString") %></div>
                        <div>Thickness: <%# Eval("Thickness") %></div>
                        <div>Style: <%# Eval("DashStyle") %></div>
                    </li>
                </ItemTemplate>
                <EditItemTemplate>
                    <li>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Description">Description:</asp:Label>
                            <asp:TextBox id="Description" runat="server" Columns="25" Text='<%# Bind("Description") %>' />
                        </div>
                        <div>
                            <asp:Label runat="server">Color:</asp:Label>
                            <d39:ColorPicker runat="server" ID="WallColor" Color='<%# Bind("Color") %>' />
                        </div>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Thickness">Thickness:</asp:Label>
                            <asp:DropDownList runat="server" ID="Thickness" SelectedValue='<%# Bind("Thickness") %>'>
                                <asp:ListItem Text="1" />
                                <asp:ListItem Text="2" />
                                <asp:ListItem Text="3" />
                                <asp:ListItem Text="4" />
                            </asp:DropDownList>
                        </div>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="DashStyle">Style:</asp:Label>
                            <asp:DropDownList runat="server" ID="DashStyle" SelectedValue='<%# Bind("DashStyle") %>'>
                                <asp:ListItem Text="Solid" />
                                <asp:ListItem Text="Dash" />
                                <asp:ListItem Text="Dot" />
                            </asp:DropDownList>
                        </div>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Opacity">Transparency:</asp:Label>
                            <asp:DropDownList runat="server" ID="Opacity" SelectedValue='<%# Bind("Opacity") %>'>
                                <asp:ListItem Value="10" Text="Opaque" />
                                <asp:ListItem Value="9" Text="90% Opaque" />
                                <asp:ListItem Value="8" Text="80% Opaque" />
                                <asp:ListItem Value="7" Text="70% Opaque" />
                                <asp:ListItem Value="6" Text="60% Opaque" />
                                <asp:ListItem Value="5" Text="50% Transparent" />
                                <asp:ListItem Value="4" Text="60% Transparent" />
                                <asp:ListItem Value="3" Text="70% Transparent" />
                                <asp:ListItem Value="2" Text="80% Transparent" />
                                <asp:ListItem Value="1" Text="90% Transparent" />
                                <asp:ListItem Value="0" Text="Transparent" />
                            </asp:DropDownList>
                        </div>
                        <div>
                            <div><asp:Label runat="server" AssociatedControlID="Segments">Enter the coordinates of each point on each wall, separated
                            by commas. One wall per line. Use "+" to indicate the middle of a square, eg A5+ or C+1 or D+4+.</asp:Label></div>
                            <asp:TextBox runat="server" TextMode="MultiLine" Columns="35" Rows="8" ID="Segments" Text='<%# Bind("SegmentsString") %>' />
                        </div>
                        <div>
                            <asp:LinkButton runat="server" ID="UpdateBtn" CommandName="Update">(Update)</asp:LinkButton>
                            <asp:LinkButton runat="server" ID="CancelBtn" CommandName="Cancel">(Cancel)</asp:LinkButton>
                        </div>
                    </li>
                </EditItemTemplate>
            </asp:ListView>
            <div runat="server" visible='<%# !IsEditing %>'>
                <asp:LinkButton runat="server" ID="AddWallBtn">(Add Wall Type)</asp:LinkButton>
            </div>

            <asp:ListView runat="server" ID="Terrains" ItemPlaceholderID="items">
                <LayoutTemplate><ul class="terrainManip"><asp:PlaceHolder runat="server" ID="items" /></ul></LayoutTemplate>
                <ItemTemplate>
                    <li style='<%# Eval("CssStyle") %>'>
                        <div>
                            Terrain Type: <%# Eval("Description") %>
                            <strong runat="server" visible='<%# Eval("IsDifficult") %>'>(Difficult)</strong>
                            <asp:LinkButton runat="server" ID="EditBtn" CommandName="Edit" Visible='<%# !IsEditing %>'>(Edit)</asp:LinkButton>
                            <asp:LinkButton runat="server" ID="DeleteBtn" CommandName="Delete" Visible='<%# !IsEditing %>'>(Delete)</asp:LinkButton>
                        </div>
                        <div>
                            Color: <%# Eval("ColorString") %>
                        </div>
                        <div><%# ((int) Eval("Opacity")) * 10 %>% opaque</div>
                        <div runat="server" visible='<%# (int)Eval("PerimeterThickness") != 0 %>'>
                            Perimeter: <%# Eval("PerimeterThickness") %> thick, <%# Eval("PerimeterDashStyle") %> <%# Eval("PerimeterColorString") %>
                        </div>
                    </li>
                </ItemTemplate>
                <EditItemTemplate>
                    <li>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Description">Description:</asp:Label>
                            <asp:TextBox id="Description" runat="server" Columns="25" Text='<%# Bind("Description") %>' />
                        </div>
                        <div><asp:CheckBox runat="server" id="Difficult" Checked='<%# Bind("IsDifficult") %>' Text="Difficult?" /></div>
                        <div>
                            <asp:Label runat="server">Color:</asp:Label>
                            <d39:ColorPicker runat="server" ID="TerrainColor" Color='<%# Bind("Color") %>' />
                        </div>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Thickness">Perimeter:</asp:Label>
                            <asp:DropDownList runat="server" ID="Thickness" SelectedValue='<%# Bind("PerimeterThickness") %>'>
                                <asp:ListItem Text="No Perimeter" Value="0" />
                                <asp:ListItem Text="1" />
                                <asp:ListItem Text="2" />
                                <asp:ListItem Text="3" />
                                <asp:ListItem Text="4" />
                            </asp:DropDownList>
                            <asp:DropDownList runat="server" ID="DashStyle" SelectedValue='<%# Bind("PerimeterDashStyle") %>'>
                                <asp:ListItem Text="Solid" />
                                <asp:ListItem Text="Dash" />
                                <asp:ListItem Text="Dot" />
                            </asp:DropDownList>
                        </div>
                        <div>
                            <d39:ColorPicker runat="server" ID="PerimeterColor" Color='<%# Bind("PerimeterColor") %>' />
                        </div>
                        <div>
                            <asp:Label runat="server" AssociatedControlID="Opacity">Transparency:</asp:Label>
                            <asp:DropDownList runat="server" ID="Opacity" SelectedValue='<%# Bind("Opacity") %>'>
                                <asp:ListItem Value="10" Text="Opaque" />
                                <asp:ListItem Value="9" Text="90% Opaque" />
                                <asp:ListItem Value="8" Text="80% Opaque" />
                                <asp:ListItem Value="7" Text="70% Opaque" />
                                <asp:ListItem Value="6" Text="60% Opaque" />
                                <asp:ListItem Value="5" Text="50% Transparent" />
                                <asp:ListItem Value="4" Text="60% Transparent" />
                                <asp:ListItem Value="3" Text="70% Transparent" />
                                <asp:ListItem Value="2" Text="80% Transparent" />
                                <asp:ListItem Value="1" Text="90% Transparent" />
                                <asp:ListItem Value="0" Text="Transparent" />
                            </asp:DropDownList>
                        </div>
                        <div>
                            <div><asp:Label runat="server" AssociatedControlID="Segments">Enter the coordinates of each corner of each terrain area, separated
                            by commas. One area per line. Use "+" to indicate the middle of a square, eg A5+ or C+1 or D+4+.</asp:Label></div>
                            <asp:TextBox runat="server" TextMode="MultiLine" Columns="35" Rows="8" ID="Segments" Text='<%# Bind("SegmentsString") %>' />
                        </div>
                        <div>
                            <asp:LinkButton runat="server" ID="UpdateBtn" CommandName="Update">(Update)</asp:LinkButton>
                            <asp:LinkButton runat="server" ID="CancelBtn" CommandName="Cancel">(Cancel)</asp:LinkButton>
                        </div>
                    </li>
                </EditItemTemplate>
            </asp:ListView>
            <div runat="server" visible='<%# !IsEditing %>'>
                <asp:LinkButton runat="server" ID="AddTerrainBtn">(Add Terrain Type)</asp:LinkButton>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
